<template>
  <div class="table">
    <el-table
      :data="tableData"
      :loading="loading"
      style="width: 100%"
      :header-cell-style="{
        background: '#F1F1F1',
        'font-size': '14px',
        'font-weight': 600,
        color: '#333333',
      }"
      :cell-style="{
        'font-size': '14px',
        'font-weight': 400,
        color: '#333333',
      }"
    >
      <el-table-column label="序号" min-width="60" fixed="left">
        <template #default="scope">
          {{ (scope.$index + 1).toString().padStart(2, "0") }}
        </template>
      </el-table-column>
      <el-table-column prop="code" label="设备编号" min-width="80" />
      <el-table-column prop="name" label="设备名称" min-width="140" />
      <el-table-column prop="vendor" label="设备厂家" min-width="240" />
      <el-table-column label="诱导级别" min-width="80">
        <template #default="scope">
          {{ scope.row.level === 1 ? "一级" : scope.row.level === 2 ? "二级" : "三级" }}
        </template>
      </el-table-column>
      <el-table-column prop="screenSize" label="屏幕尺寸" min-width="100" />
      <el-table-column prop="address" label="具体位置" min-width="200" />
      <el-table-column prop="createdTime" label="操作时间" min-width="170" />
      <el-table-column label="操作" min-width="90" fixed="right">
        <template #default="scope">
          <el-button
            @click="configGuide(scope.row)"
            type="primary"
            size="small"
            link
            style="color: #007aff; font-size: 14px"
            >配置屏显</el-button
          >
        </template>
      </el-table-column>
      <template #empty>
        <el-empty :image="imgNone" />
      </template>
    </el-table>
  </div>
</template>

<script setup>
import { reactive, ref, defineProps } from "vue";
const imgNone = new URL("@/assets/image/imgNone.png", import.meta.url).href;
const emits = defineEmits(["table"]);

const props = defineProps({
  tableData: {
    type: Object,
    default: () => {},
  },
  loading: {
    type: Boolean,
    default: false,
  },
});

// 配置屏显
const configGuide = (row) => {
  row.operation = 1;
  emits("table", row);
};
</script>

<style lang="less" scoped>
.table {
  margin-bottom: 15px;
}
</style>
